﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Panel.Master" Inherits="System.Web.Mvc.ViewPage<Prodma.DataAccess.Models.ViewModels.MenuVm>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%=System.Configuration.ConfigurationManager.AppSettings["pageTitle"] %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div class="listHeader">
    <img src="../../Images/ListImages/menulist.png" alt="" class="listHeaderIco" />
    <div class="listHeaderText">Menü Yöneticisi : <%=ViewData.Model.Name %></div>
    
    <div class="listHeaderMenuBox">
        <% Html.RenderPartial("/views/shared/userControls/acceptance.ascx",
               new Prodma.DataAccess.Models.UserControlViewModels.AcceptanceVm()
               {
                   View = "menu",
                   Keys = new List<string>() { "location" },
                   Values = new List<string>() { Request.QueryString["location"] }
               }); %>
    </div>
</div>

<form method="post" action="/menu/edit/">
<div class="detailContainer">
    <div class="detailSection-50pc">
        <div class="detailSectionHeader">Giriş Bilgileri</div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Adı :</div>
            <div class="detailSectionRowText-80pc"><input type="text" id="name" name="name" maxlength="100" class="detailSectionControl" value='<%=ViewData.Model.Name %>' /></div>
        </div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Yazılar :</div>
            <div class="detailSectionRowText-80pc">
                <input type="button" class="detailSectionControlButton" value="Yazı Seç" onclick="document.getElementById('contentListSubmitButton').click();" />
                <span class="detailSectionDataSpan"><%=ViewData["contentNameData"]%></span>
            </div>
        </div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Kategori :</div>
            <div class="detailSectionRowText-80pc">
                <input type="button" class="detailSectionControlButton" value="Kategori Seç" onclick="document.getElementById('categoryListSubmitButton').click();"  />
                <span class="detailSectionDataSpan"><%=ViewData["categoryNameData"]%></span>
            </div>
        </div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Link :</div>
            <div class="detailSectionRowText-80pc">
                <input type="button" class="detailSectionControlButton" value="Link Seç" onclick="selectLink();" />
                <span class="detailSectionDataSpan"><%=ViewData["urlData"] %></span>
            </div>
        </div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Hedef :</div>
            <div class="detailSectionRowText-80pc"><%=Html.DropDownList("ddlTarget", (SelectList)ViewData["targetList"], "Seçiniz", new { @class = "detailSectionControlCombo" })%></div>
        </div>
    </div>
    <div class="detailSection-50pc">
        <div class="detailSectionHeader">Sistem Bilgileri</div>
        <div class="detailSectionRow">
            <div class="detailSectionRowTitle-20pc">Durum :</div>
            <div class="detailSectionRowText-80pc"><%=Html.DropDownList("ddlState", (SelectList)ViewData["stateList"], "Seçiniz", new { @class = "detailSectionControlCombo" })%></div>
        </div>
    </div>
    <input type="hidden" id="id" name="id" value='<%=ViewData.Model.Id %>' />
    <input type="hidden" id="location" name="location" value='<%=ViewData.Model.Location.Id %>' />
    
    <input type="hidden" id="menuType" name="menuType" value='<%=ViewData.Model.Type.Id %>' />
    <input type="hidden" id="itemId" name="itemId" value='<%=ViewData.Model.Item %>' />
    <input type="hidden" id="url" name="url" value='<%=ViewData.Model.Url %>' />
    
</div>
</form>

<div class="panelAjaxListContainer">  
    <div>  
        <%using (Ajax.BeginForm("GetContentListAJAX", new AjaxOptions() { UpdateTargetId = "contentListDiv", OnBegin = "contentAjaxLoading", OnSuccess="contentAjaxLoaded" })) %>
        <% { %>  
            <input id="contentListSubmitButton" type="submit" value="Yazılar" class="panelAjaxSubmitButton" />  
        <% } %>  
        <div id="contentListDiv" class="panelAjaxList">  
        </div> 
    </div>  
</div>

<div class="panelAjaxListContainer">  
    <div>  
        <%using (Ajax.BeginForm("GetCategoryListAJAX", new AjaxOptions() { UpdateTargetId = "categoryListDiv", OnBegin = "categoryAjaxLoading", OnSuccess="categoryAjaxLoaded" })) %>
        <% { %>  
            <input id="categoryListSubmitButton" type="submit" value="Kategoriler" class="panelAjaxSubmitButton" />  
        <% } %>  
        <div id="categoryListDiv" class="panelAjaxList">  
        </div>  
    </div>  
</div>

<script type="text/javascript">
    function submitForm() {
        if (menuValidate()) {
            document.forms[0].submit();
        }
    }
    function selectLink() {
        $.prompt('Link : <input type="text" id="url" name="url" class="jqiLinkTextControl" maxlength="250" />', {
            callback: mycallbackform,
            buttons: { Tamam: 'Tamam' }
        });
    }
    function mycallbackform(v, m, f) {
        $('#menuType').attr('value', 3);
        $('#url').attr('value', f.url);
    }
    function selectItem(typeId, id) {
        document.getElementById("menuType").value = typeId;
        document.getElementById("itemId").value = id;
        closeSelectPanel();
    }
    function closeSelectPanel() {
        $('#contentListDiv').html('');
        $('#categoryListDiv').html('');
    }
    function contentAjaxLoading() {
        $('#contentListDiv').html('<div><img src="/images/ajaxload.gif"/></div>');
        $('#categoryListDiv').html('');
    }
    function contentAjaxLoaded() {
        $.prompt.close();
        $.prompt($('#contentListDiv').html(), { buttons: { Kapat: false} });
    }
    function categoryAjaxLoading() {
        $('#categoryListDiv').html('<div><img src="/images/ajaxload.gif"/></div>');
        $('#contentListDiv').html('');
    }
    function categoryAjaxLoaded() {
        $.prompt.close();
        $.prompt($('#categoryListDiv').html(), { buttons: { Kapat: false} });
    }
</script>

</asp:Content>
